Method and device for processing video signal by using reduced secondary transform

ABSTRACT

The present disclosure provides a method of reconstructing a video signal based on a reduced secondary transform, which includes: obtaining a secondary transform index from the video signal; deriving a secondary transform corresponding to the secondary transform index, wherein the secondary transform represents a reduced secondary transform, and the reduced secondary transform represents a transform outputting L (L&lt;N) transform coefficient data (L×1 transform coefficient vectors) based on inputted N residual data (N×1 residual vectors); obtaining a transform coefficient block by performing an entropy decoding and a dequantization for a current block (N×N); performing an inverse secondary transform for the transform coefficient block using the reduced secondary transform; performing an inverse primary transform for a block which the inverse secondary transform is applied to; and reconstructing the current block using a block which the inverse primary transform is applied to.

CROSS-REFERENCE TO RELATED APPLICATIONS

Pursuant to 35 U.S.C. § 119(e), this application is a continuation ofInternational Application No. PCT/KR2019/003812, with an internationalfiling date of Apr. 1, 2019, which claims the benefit of U.S.Provisional Application No. 62/651,251 filed on Apr. 1, 2018, thecontents of which are all hereby incorporated by reference herein intheir entirety.

TECHNICAL FIELD

The present disclosure relates to a method and a device for processing avideo signal, and more particularly, to a design of a Reduced SecondaryTransform (RST) which may be applied to a 4×4 block, a layout and a scanorder of transform coefficients generated after a 4×4 RST, and atransform index coding method for designating the 4×4 RST to be applied.

BACKGROUND ART

Next-generation video content will have characteristics of a highspatial resolution, a high frame rate, and high dimensionality of scenerepresentation. In order to process such content, technologies, such asmemory storage, a memory access rate, and processing power, will beremarkably increased.

Accordingly, it is necessary to design a new coding tool for moreefficiently processing next-generation video content. Particularly, itis necessary to design a more efficient transform in terms of codingefficiency and complexity when a transform is applied.

SUMMARY

An embodiment of the present disclosure provides an encoder/decoderstructure for reflecting a new transform design.

Furthermore, an embodiment of the present disclosure provides a designof a Reduced Secondary Transform (RST) which may be applied to a 4×4block, a layout and a scan order of transform coefficients generatedafter a 4×4 RST, and a method and a structure of transform index codingfor designating the 4×4 RST to be applied.

The present disclosure provides a method for reducing complexity andenhancing coding efficiency through a new transform design.

The present disclosure provides a method for designing an RST that maybe applied to a 4×4 block.

The present disclosure provides a configuration of a region to which the4×4 RST is to be applied, a method for arranging transform coefficientsgenerated after applying the 4×4 RST, a scan order of the arrangedtransform coefficients, a method for sorting and combining transformcoefficients generated for each block, and the like.

The present disclosure provides a method for coding a transform indexthat specifies the 4×4 RST.

The present disclosure provides a method for conditionally coding acorresponding transform index by checking whether a non-zero transformcoefficient exists in an unacceptable region when applying the 4×4 RST.

The present disclosure provides a method for conditionally coding thecorresponding transform index after coding a last non-zero transformcoefficient position, and then omitting relevant residual coding forpositions that are not accepted.

The present disclosure provides a method for applying differenttransform index coding and residual coding to a luma block and a chromablock when applying the 4×4 RST.

According to the present disclosure, when a still image or a movingpicture is encoded, a computational amount can be significantly reducedcompared with a case where another non-separable secondary transform(NSST) is applied by applying a 4×4 RST.

Furthermore, by considering that a valid transform coefficient does notexist in a specific region when applying the 4×4 RST, a performance canbe enhanced by conditionally coding a transform index designating the4×4 RST and applying optimization of related residual coding.

As described above, a computational complexity can be reduced and codingefficiency can be enhanced through a new low-complexity computationalgorithm.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating the configuration of an encoderfor encoding a video signal according to an embodiment of the presentdisclosure.

FIG. 2 is a block diagram illustrating the configuration of a decoderfor decoding a video signal according to an embodiment of the presentdisclosure.

FIGS. 3A though 3D illustrate embodiments to which the disclosure may beapplied, FIG. 3A is a diagram for describing a block split structurebased on a quadtree (hereinafter referred to as a “QT”), FIG. 3B is adiagram for describing a block split structure based on a binary tree(hereinafter referred to as a “BT”), FIG. 3C is a diagram for describinga block split structure based on a ternary tree (hereinafter referred toas a “TT”), and FIG. 3D is a diagram for describing a block splitstructure based on an asymmetric tree (hereinafter referred to as an“AT”).

FIG. 4 is an embodiment to which the disclosure is applied andillustrates a schematic block diagram of a transform and quantizationunit 120/130 and a dequantization and transform unit 140/150 within anencoder.

FIG. 5 is an embodiment to which the disclosure is applied andillustrates a schematic block diagram of a dequantization and transformunit 220/230 within a decoder.

FIG. 6 is a table showing a transform configuration group to whichMultiple Transform Selection (MTS) is applied as an embodiment to whichthe present disclosure is applied.

FIG. 7 is a flowchart showing an encoding process in which MultipleTransform Selection (MTS) is performed as an embodiment to which thepresent disclosure is applied.

FIG. 8 is a flowchart showing a decoding process in which MultipleTransform Selection (MTS) is performed as an embodiment to which thepresent disclosure is applied.

FIG. 9 is a flowchart for describing a process of encoding an MTS flagand an MTS index as an embodiment to which the present disclosure isapplied.

FIG. 10 is a flowchart for describing a decoding process in whichhorizontal transform or vertical transform is applied to a row or acolumn based on an MTS flag and an MTS index as an embodiment to whichthe present disclosure is applied.

FIG. 11 is a flowchart of performing inverse transform based on atransform related parameter as an embodiment to which the presentdisclosure is applied.

FIG. 12 is a table showing allocation of a transform set for each intraprediction mode in an NSST as an embodiment to which the presentdisclosure is applied.

FIG. 13 is a calculation flow diagram for givens rotation as anembodiment to which the present disclosure is applied.

FIG. 14 illustrates one round configuration in 4×4 NSST constituted by agivens rotation layer and permutations as an embodiment to which thepresent disclosure is applied.

FIGS. 15A and 15B is a block diagram for describing operations of aforward reduced transform and an inverse reduced transform as anembodiment to which the present disclosure is applied.

FIG. 16 is a diagram illustrating a process of performing an inversescan from 64^(th) to 17^(th) according to an inverse scan order as anembodiment to which the present disclosure is applied.

FIGS. 17A through 17C illustrates three forward scan orders for atransform coefficient block (transform block) as an embodiment to whichthe present disclosure is applied.

FIG. 18 illustrates positions of valid transform coefficients and aforward scan order for each of 4×4 blocks when diagonal scan is appliedand 4×4 RST is applied in upper left 4×8 blocks as an embodiment towhich the present disclosure is applied.

FIGS. 19A and 19B illustrates a case where valid transform coefficientsof two 4×4 blocks are combined into one 4×4 block when a diagonal scanis applied and 4×4 RST is applied in upper left 4×8 blocks as anembodiment to which the present disclosure is applied.

FIG. 20 is a flowchart of encoding a video signal based on a reducedsecondary transform as an embodiment to which the present disclosure isapplied.

FIG. 21 is a flowchart of decoding a video signal based on reducedsecondary transform as an embodiment to which the present disclosure isapplied.

FIG. 22 is an architectural diagram of a content streaming system as anembodiment to which the present disclosure is applied.

BEST MODE

The present disclosure provides a method of reconstructing a videosignal based on a reduced secondary transform, which includes: obtaininga secondary transform index from the video signal; deriving a secondarytransform corresponding to the secondary transform index, wherein thesecondary transform represents a reduced secondary transform, and thereduced secondary transform represents a transform outputting L (L<N)transform coefficient data (L×1 transform coefficient vectors) based oninputted N residual data (N×1 residual vectors); obtaining a transformcoefficient block by performing an entropy decoding and a dequantizationfor a current block (N×N); performing an inverse secondary transform forthe transform coefficient block using the reduced secondary transform;performing an inverse primary transform for a block which the inversesecondary transform is applied to; and reconstructing the current blockusing a block which the inverse primary transform is applied to.

The present disclosure is characterized in that the reduced secondarytransform is applied to a specific region of the current block, and thespecific region is a left-top M×M (M≤N) in the current block.

The present disclosure is characterized in that when the inversesecondary transform is performed, a 4×4 reduced secondary transform isapplied to each of divided 4×4 blocks in the current block.

The present disclosure is characterized in that whether the secondarytransform index is obtained is determined based on a position of a lastnon-zero transform coefficient in the transform coefficient block.

The present disclosure is characterized in that when the last non-zerotransform coefficient is not located in a specific region, the secondarytransform index is obtained, and the specific region represents aremaining region other than a position where a non-zero transformcoefficient may exist when transform coefficients are arranged accordingto a scan order if the reduced secondary transform is applied.

The method further includes: obtaining a primary transform index of thecurrent block from the video signal, wherein the primary transform indexcorresponds to any one of a plurality of transform combinationsconfigured by a combination of DST7 and/or DCT8; and deriving atransform combination corresponding to the primary transform index, inwhich the transform combination includes a horizontal transform and avertical transform, and the horizontal transform and the verticaltransform correspond to any one of the DST7 or the DCT8, and the inverseprimary transform is performed using the transform combination.

The present disclosure provides an apparatus of reconstructing a videosignal based on a reduced secondary transform, which includes: a parsingunit obtaining a secondary transform index from the video signal; atransform unit deriving a secondary transform corresponding to thesecondary transform index, wherein the secondary transform represents areduced secondary transform, and the reduced secondary transformrepresents a transform outputting L (L<N) transform coefficient data(L×1 transform coefficient vectors) based on inputted N residual data(N×1 residual vectors); an entropy decoding unit performing an entropydecoding for a current block (N×N); a dequantization unit performing adequantization for the current block in which the entropy decoding isperformed to obtain a transform coefficient block; the transform unitperforming an inverse secondary transform for the transform coefficientblock using the reduced secondary transform and performing an inverseprimary transform and performing an inverse primary transform for ablock which the inverse secondary transform is applied to; and areconstruction unit reconstructing the current block using a block whichthe inverse primary transform is applied to.

DETAILED DESCRIPTION

Hereinafter, a configuration and operation of an embodiment of thepresent disclosure will be described in detail with reference to theaccompanying drawings, a configuration and operation of the presentdisclosure described with reference to the drawings are described as anembodiment, and the scope, a core configuration, and operation of thepresent disclosure are not limited thereto.

Further, terms used in the present disclosure are selected fromcurrently widely used general terms, but in a specific case, randomlyselected terms by an applicant are used. In such a case, in a detaileddescription of a corresponding portion, because a meaning thereof isclearly described, the terms should not be simply construed with only aname of terms used in a description of the present disclosure and ameaning of the corresponding term should be comprehended and construed.

Further, when there is a general term selected for describing theinvention or another term having a similar meaning, terms used in thepresent disclosure may be replaced for more appropriate interpretation.For example, in each coding process, a signal, data, a sample, apicture, a frame, and a block may be appropriately replaced andconstrued. Further, in each coding process, partitioning, decomposition,splitting, and division may be appropriately replaced and construed.

In the present disclosure, Multiple Transform Selection (MTS) may referto a method for performing transform using at least two transform types.This may also be expressed as an Adaptive Multiple Transform (AMT) orExplicit Multiple Transform (EMT), and likewise, mts_idx may also beexpressed as AMT_idx, EMT_idx, tu_mts_idx, AMTTU_idx, EMT_TU_idx,transform index, or transform combination index and the presentdisclosure is not limited to the expressions.

FIG. 1 shows a schematic block diagram of an encoder for encoding avideo signal, in accordance with one embodiment of the presentdisclosure.

Referring to FIG. 1, the encoder 100 may include an image segmentationunit 110, a transform unit 120, a quantization unit 130, adequantization unit 140, an inverse transform unit 150, a filtering unit160, a decoded picture buffer (DPB) 170, an inter-prediction unit 180,an intra-predictor 185 and an entropy encoding unit 190.

The image segmentation unit 110 may segment an input image (or a pictureor frame), input to the encoder 100, into one or more processing units.For example, the process unit may be a coding tree unit (CTU), a codingunit (CU), a prediction unit (PU), or a transform unit (TU).

However, the terms are used only for convenience of illustration of thepresent disclosure, the present disclosure is not limited to thedefinitions of the terms. In the present disclosure, for convenience ofillustration, the term “coding unit” is employed as a unit used in aprocess of encoding or decoding a video signal, however, the presentdisclosure is not limited thereto, another process unit may beappropriately selected based on contents of the present disclosure.

The encoder 100 may generate a residual signal by subtracting aprediction signal output from the inter prediction unit 180 or intraprediction unit 185 from the input image signal. The generated residualsignal may be transmitted to the transform unit 120.

The transform unit 120 may generate a transform coefficient by applyinga transform scheme to a residual signal. The transform process may beapplied a block (square or rectangle) split by a square block of aquadtree structure or a binarytree structure, a ternary structure or anasymmetric structure.

The transform unit 120 may perform a transform based on a plurality oftransforms (or transform combinations), and the transform scheme may bereferred to as multiple transform selection (MTS). The MTS may also bereferred to as an Adaptive Multiple Transform (AMT) or an EnhancedMultiple Transform (EMT).

The MTS (or AMT or EMT) may refer to a transform scheme performed basedon a transform (or transform combinations) adaptively selected from theplurality of transforms (or transform combinations).

The plurality of transforms (or transform combinations) may include thetransforms (or transform combinations) described in FIG. 6 of thepresent disclosure. In the present disclosure, the transform ortransform type may be expressed as, for example, DCT-Type 2, DCT-II,DCT2, or DCT-2.

The transform unit 120 may perform the following embodiments.

The present disclosure provides a method for designing an RST that maybe applied to a 4×4 block.

The present disclosure provides a configuration of a region to which the4×4 RST is to be applied, a method for arranging transform coefficientsgenerated after applying the 4×4 RST, a scan order of the arrangedtransform coefficients, a method for sorting and combining transformcoefficients generated for each block, and the like.

The present disclosure provides a method for coding a transform indexthat specifies the 4×4 RST.

The present disclosure provides a method for conditionally coding acorresponding transform index by checking whether a non-zero transformcoefficient exists in an unacceptable region when applying the 4×4 RST.

The present disclosure provides a method for conditionally coding thecorresponding transform index after coding a last non-zero transformcoefficient position, and then omitting relevant residual coding forpositions that are not accepted.

The present disclosure provides a method for applying differenttransform index coding and residual coding to a luma block and a chromablock when applying the 4×4 RST.

Detailed embodiments thereof will be described in more detail in thepresent disclosure.

The quantization unit 130 may quantize the transform coefficient andtransmits the quantized transform coefficient to the entropy encodingunit 190 and the entropy encoding unit 190 may entropy-code a quantizedsignal and output the entropy-coded quantized signal as a bitstream.

Although the transform unit 120 and the quantization unit 130 aredescribed as separate functional units, the present disclosure is notlimited thereto and may be combined into one functional unit. Thedequantization unit 140 and the inverse transform unit 150 may also besimilarly combined into one functional unit.

A quantized signal output from the quantization unit 130 may be used forgenerating the prediction signal. For example, inverse quantization andinverse transform are applied to the quantized signal through thedequantization unit 140 and the inverse transform unit 1850 in a loop toreconstruct the residual signal. The reconstructed residual signal isadded to the prediction signal output from the inter-prediction unit 180or the intra-prediction unit 185 to generate a reconstructed signal.

Meanwhile, deterioration in which a block boundary is shown may occurdue to a quantization error which occurs during such a compressionprocess. Such a phenomenon is referred to as blocking artifacts and thisis one of key elements for evaluating an image quality. A filteringprocess may be performed in order to reduce the deterioration. Blockingdeterioration is removed and an error for the current picture is reducedthrough the filtering process to enhance the image quality.

The filtering unit 160 applies filtering to the reconstructed signal andoutputs the applied reconstructed signal to a reproduction device ortransmits the output reconstructed signal to the decoded picture buffer170. The inter-prediction unit 170 may use the filtered signaltransmitted to the decoded picture buffer 180 as the reference picture.As such, the filtered picture is used as the reference picture in theinter prediction mode to enhance the image quality and the encodingefficiency.

The decoded picture buffer 170 may store the filtered picture in orderto use the filtered picture as the reference picture in theinter-prediction unit 180.

The inter-prediction unit 180 performs a temporal prediction and/orspatial prediction in order to remove temporal redundancy and/or spatialredundancy by referring to the reconstructed picture. Here, since thereference picture used for prediction is a transformed signal that isquantized and dequantized in units of the block at the time ofencoding/decoding in the previous time, blocking artifacts or ringingartifacts may exist.

Accordingly, the inter-prediction unit 180 may interpolate a signalbetween pixels in units of a sub-pixel by applying a low-pass filter inorder to solve performance degradation due to discontinuity orquantization of such a signal. Here, the sub-pixel means a virtual pixelgenerated by applying an interpolation filter and an integer pixel meansan actual pixel which exists in the reconstructed picture. As aninterpolation method, linear interpolation, bi-linear interpolation,wiener filter, and the like may be adopted.

An interpolation filter is applied to the reconstructed picture toenhance precision of prediction. For example, the inter-prediction unit180 applies the interpolation filter to the integer pixel to generate aninterpolated pixel and the prediction may be performed by using aninterpolated block constituted by the interpolated pixels as theprediction block.

Meanwhile, the intra-prediction unit 185 may predict the current blockby referring to samples in the vicinity of a block which is to besubjected to current encoding. The intra-prediction unit 185 may performthe following process in order to perform the intra prediction. First, areference sample may be prepared, which is required for generating theprediction signal. In addition, the prediction signal may be generatedby using the prepared reference sample. Thereafter, the prediction modeis encoded. In this case, the reference sample may be prepared throughreference sample padding and/or reference sample filtering. Since thereference sample is subjected to prediction and reconstructionprocesses, a quantization error may exist. Accordingly, a referencesample filtering process may be performed with respect to eachprediction mode used for the intra prediction in order to reduce such anerror.

The prediction signal generated through the inter-prediction unit 180 orthe intra-prediction unit 185 may be used for generating thereconstructed signal or used for generating the residual signal.

FIG. 2 is a schematic block diagram of a decoder in which decoding of avideo signal is performed as an embodiment to which the presentdisclosure is applied.

Referring to FIG. 2, the decoder 200 may be configured to include aparsing unit (not illustrated), an entropy decoding unit 210, adequantization unit 220, an inverse transform unit 230, a filtering unit240, a decoded picture buffer (DPB) unit 250, an inter-prediction unit260, and an intra-prediction unit 265.

In addition, a reconstructed video signal output through the decoder 200may be reproduced through a reproduction device.

The decoder 200 may receive the signal output from the encoder 100 ofFIG. 1 and the received signal may be entropy-decoded through theentropy decoding unit 210.

The dequantization unit 220 obtains the transform coefficient from anentropy-decoded signal by using quantization step size information.

The inverse transform unit 230 inversely transforms the transformcoefficient to obtain the residual signal.

Here, the present disclosure provides a method for configuring atransform combination for each transform configuration group divided byat least one of a prediction mode, a block size or a block shape and theinverse transform unit 230 may perform inverse transform based on thetransform combination configured by the present disclosure. Further, theembodiments described in the present disclosure may be applied.

The inverse transform unit 230 may perform the following embodiments.

The present disclosure provides a method for reconstructing the videosignal based on reduced secondary transform.

The inverse transform unit 230 may derive a secondary transformcorresponding to a secondary transform index, perform inverse secondarytransform for the transform coefficient block by using the secondarytransform, and perform inverse primary transform for the block in whichthe inverse secondary transform is performed. Here, the secondarytransform refers to the reduced secondary transform and the reducedsecondary transform represents a transform in which N residual data (N×1residual vectors) are input to output L (L<N) transform coefficient data(L×1 transform coefficient vectors).

The present disclosure is characterized in that the reduced secondarytransform is applied to a specific region of the current block and thespecific region is an upper left M×M (M≤N) in the current block.

The present disclosure is characterized in that 4×4 reduced secondarytransform is applied to each of 4×4 blocks divided in the current blockswhen the inverse secondary transform is performed.

The present disclosure is characterized in that it is determined whetherthe secondary transform index is obtained based on the position of thelast non-zero transform coefficient in the transform coefficient block.

The present disclosure is characterized in that when the last non-zerotransform coefficient is not positioned in the specific region, thesecondary transform index is obtained and the specific region indicatesremaining regions other than a position when the non-zero transformcoefficient may exist when the transform coefficients are arrangedaccording to the scan order in the case where the reduced secondarytransform is applied.

The inverse transform unit 230 may derive a transform combinationcorresponding to a primary transform index and perform an inverseprimary transform by using the transform combination. Here, the primarytransform index corresponds to any one of a plurality of transformcombinations constituted by a combination of DST7 and/or DCT8 and thetransform combination includes a horizontal transform and a verticaltransform. In this case, the horizontal transform and the verticaltransform correspond to either the DST7 or the DCT8.

The dequantization unit 220 and the transform unit 230 are described asseparate function units, but the disclosure is not limited thereto. Thedequantization unit 220 and the transform unit 230 may be combined intoa single function unit.

A reconstructed signal is generated by adding the obtained residualsignal to a prediction signal output by the inter prediction unit 260 orthe intra prediction unit 265.

The filter 240 may output or transmit the reconstructed signal to aplayback device or the decoded picture buffer unit 250 by applyingfiltering to the reconstructed signal. The filtered signal transmittedto the decoded picture buffer unit 250 may be used as a referencepicture in the inter prediction unit 260.

In the disclosure, the embodiments described in the transform unit 120and each function unit of the encoder 100 may be identically applied tothe transform unit 230 and corresponding function unit of the decoder.

FIGS. 3A through 3D illustrate embodiments to which the disclosure maybe applied, FIG. 3A is a diagram for describing a block split structurebased on a quadtree (hereinafter referred to as a “QT”), FIG. 3B is adiagram for describing a block split structure based on a binary tree(hereinafter referred to as a “BT”), FIG. 3C is a diagram for describinga block split structure based on a ternary tree (hereinafter referred toas a “TT”), and FIG. 3D is a diagram for describing a block splitstructure based on an asymmetric tree (hereinafter referred to as an“AT”).

In video coding, one block may be split based on a quadtree (QT).Furthermore, one subblock split by the QT may be further splitrecursively using the QT. A leaf block that is no longer QT split may besplit using at least one method of a binary tree (BT), a ternary tree(TT) or an asymmetric tree (AT). The BT may have two types of splits ofa horizontal BT (2N×N, 2N×N) and a vertical BT (N×2N, N×2N). The TT mayhave two types of splits of a horizontal TT (2N×1/2N, 2N×N, 2N×1/2N) anda vertical TT (1/2N×2N, N×2N, 1/2N×2N). The AT may have four types ofsplits of a horizontal-up AT (2N×1/2N, 2N×3/2N), a horizontal-down AT(2N×3/2N, 2N×1/2N), a vertical-left AT (1/2N×2N, 3/2N×2N), and avertical-right AT (3/2N×2N, 1/2N×2N). Each BT, TT, or AT may be furthersplit recursively using the BT, TT, or AT.

FIG. 3A shows an example of a QT split. A block A may be split into foursubblocks A0, A1, A2, and A3 by a QT. The subblock Al may be split intofour subblocks B0, B1, B2, and B3 by a QT.

FIG. 3B shows an example of a BT split. A block B3 that is no longersplit by a QT may be split into vertical BTs C0 and C1 or horizontal BTsD0 and D1. As in the block C0, each subblock may be further splitrecursively like the form of horizontal BTs E0 and E1 or vertical BTs F0and F1.

FIG. 3C shows an example of a TT split. A block B3 that is no longersplit by a QT may be split into vertical TTs C0, C1, and C2 orhorizontal TTs D0, D1, and D2. As in the block C1, each subblock may befurther split recursively like the form of horizontal TTs E0, E1, and E2or vertical TTs F0, F1, and F2.

FIG. 3D shows an example of an AT split. A block B3 that is no longersplit by a QT may be split into vertical ATs C0 and C1 or horizontal ATsD0 and D1. As in the block C1, each subblock may be further splitrecursively like the form of horizontal ATs E0 and E1 or vertical TTs F0and F1.

Meanwhile, BT, TT, and AT splits may be split together. For example, asubblock split by a BT may be split by a TT or AT. Furthermore, asubblock split by a TT may be split by a BT or AT. A subblock split byan AT may be split by a BT or TT. For example, after a horizontal BTsplit, each subblock may be split into vertical BTs or after a verticalBT split, each subblock may be split into horizontal BTs. The two typesof split methods are different in a split sequence, but have the samefinally split shape.

Furthermore, if a block is split, the sequence that the block issearched may be defined in various ways. In general, the search isperformed from left to right or from top to bottom. To search a blockmay mean a sequence for determining whether to split an additional blockof each split subblock or may mean a coding sequence of each subblock ifa block is no longer split or may mean a search sequence wheninformation of another neighbor block is referred in a subblock.

FIGS. 4 and 5 are embodiments to which the disclosure is applied. FIG. 4illustrates a schematic block diagram of a transform and quantizationunit 120/130 and a dequantization and transform unit 140/150 within theencoder, and FIG. 5 illustrates a schematic block diagram of adequantization and transform unit 220/230 within the decoder.

Referring to FIG. 4, the transform and quantization unit 120/130 mayinclude a primary transform unit 121, a secondary transform unit 122 andthe quantization unit 130. The dequantization and transform unit 140/150may include the dequantization unit 140, an inverse secondary transformunit 151 and an inverse primary transform unit 152.

Referring to FIG. 5, the dequantization and transform unit 220/230 mayinclude the dequantization unit 220, an inverse secondary transform unit231 and an inverse primary transform unit 232.

In the disclosure, when a transform is performed, the transform may beperformed through a plurality of steps. For example, as in FIG. 4, twosteps of a primary transform and a secondary transform may be applied ormore transform steps may be used according to an algorithm. In thiscase, the primary transform may be referred to as a core transform.

The primary transform unit 121 may apply a primary transform on aresidual signal. In this case, the primary transform may be pre-definedin a table form in the encoder and/or the decoder.

A discrete cosine transform type 2 (hereinafter “DCT2”) may be appliedto the primary transform. Alternatively, a discrete sine transform-type7 (hereinafter called “DST7”) may be applied to a specific case. Forexample, in the intra prediction mode, the DST7 may be applied to a 4×4block.

Further, the primary transform may adopt combinations of varioustransforms DST 7, DCT 8, DST 1, and DCT 5 of the multiple transformselection (MTS). For example, FIG. 6 may be adopted.

The secondary transform unit 122 may apply the secondary transform to aprimary transformed signal and here, the secondary transform may bepredefined in the table in the encoder and/or the decoder.

As an embodiment, the secondary transform may conditionally adopt anon-separable secondary transform (hereinafter, referred to as ‘NSST’).For example, the NSST may be applied only to the intra-prediction blockand may have a transform set applicable to each prediction mode group.

Here, the prediction mode group may be configured based on symmetry withrespect to a prediction direction. For example, since prediction mode 52and prediction mode 16 are symmetrical based on prediction mode 34(diagonal direction), the same transform set may be applied by formingone group. In this case, when the transform for prediction mode 52 isapplied, input data is transposed and then applied because predictionmode 52 has the same transform set as prediction mode 16.

Meanwhile, since the symmetry for the direction does not exist in thecase of a planar mode and a DC mode, each mode has a different transformset and the corresponding transform set may be constituted by twotransforms. In respect to the remaining direction modes, each transformset may be constituted by three transforms.

As another embodiment, the secondary transform may adopt combinations ofvarious transforms DST 7, DCT 8, DST 1, and DCT 5 of the multipletransform selection (MTS). For example, FIG. 6 may be adopted.

As another embodiment, the DST 7 may be applied to the secondarytransform.

As another embodiment, the NSST may not be applied to the entire primarytransformed block but may be applied only to a top-left 8×8 region. Forexample, when the block size is 8×8 or more, 8×8 NSST is applied andwhen the block size is less than 8×8, 4×4 NSST is applied and in thiscase, the block is divided into 4×4 blocks and then, the 4×4 NSST isapplied to each of the divided blocks.

As another embodiment, even in the case of 4×N/N×4 (N>=16), the 4×4 NSSTmay be applied.

The NSST, the 4×4 NSST, and the 8×8 NSST will be described in moredetail with reference to FIGS. 12 to 15 and other embodiments in thepresent disclosure.

The quantization unit 130 may perform quantization for the secondarytransformed signal.

The dequantization and inverse transform units 140 and 150 perform theabove-described process in reverse, and a redundant description thereofwill be omitted.

FIG. 5 is a schematic block diagram of a dequantization unit 220 and aninverse transform unit 230 in a decoder.

Referring to FIG. 5 above, the dequantization and inverse transformunits 220 and 230 may include a dequantization unit 220, an inversesecondary transform unit 231, and an inverse primary transform unit 232.

The dequantization unit 220 obtains the transform coefficient from anentropy-decoded signal by using quantization step size information.

The inverse secondary transform unit 231 performs an inverse secondarytransform for the transform coefficients. Here, the inverse secondarytransform represents an inverse transform of the secondary transformdescribed in FIG. 4 above.

As another embodiment, the secondary transform may adopt combinations ofvarious transforms DST 7, DCT 8, DST 1, and DCT 5 of the multipletransform selection (MTS). For example, FIG. 6 may be adopted.

The inverse primary transform unit 232 performs an inverse primarytransform for the inverse secondary transformed signal (or block) andobtains the residual signal. Here, the inverse primary transformrepresents the inverse transform of the primary transform described inFIG. 4.

As an embodiment, the primary transform may adopt combinations ofvarious transforms DST 7, DCT 8, DST 1, and DCT 5 of the multipletransform selection (MTS). For example, FIG. 6 may be adopted.

As an embodiment of the present disclosure, the DST 7 may be applied tothe primary transform.

As an embodiment of the present disclosure, the DCT 8 may be applied tothe primary transform.

The present disclosure provides a method for configuring a transformcombination for each transform configuration group divided by at leastone of a prediction mode, a block size or a block shape and the inverseprimary transform unit 232 may perform the inverse transform based onthe transform combination configured by the present disclosure. Further,the embodiments described in the present disclosure may be applied.

FIG. 6 is a table showing a transform configuration group to whichMultiple Transform Selection (MTS) is applied as an embodiment to whichthe present disclosure is applied.

Transform configuration group to which Multiple Transform Selection(MTS) is applied

In the present disclosure, a j-th transform combination candidate fortransform configuration group G_(i) is represented by a pair shown inEquation 1 below.

(H(G_(i), j), V(G_(i), j))   (1)

Here, H(G_(i), j) indicates the horizontal transform for the j-thcandidate, and V(Gi, j) indicates the vertical transform for the j-thcandidate. For example, in FIG. 6, H(G₃, 2)=DST7, V(G3, 2)=DCT8 may berepresented. Depending on a context, a value assigned to H(G_(i), j) orV(G_(i), j) may be a nominal value to distinguish transformations, as inthe example above or may be an index value indicating the transform ormay be a 2 dimensional (D) matrix for the transform.

Further, in the present disclosure, a 2D matrix value for DCT and DSTmay be represented as shown in Equation 2 and 3 below.

DCT type 2: C_(N) ^(II), DCT type 8: C_(N) ^(VIII)   (2)

DST type 7: S_(N) ^(VII), DST type 4: S_(N) ^(IV)   (3)

Here, whether the transform is DST or DCT is represented by S or C, atype number is represented by a superposition in the form of Romannumbers and N of a subscript indicates that the transform is an N×Ntransform. Further, 2D matrixes such as the C_(N) ^(II) and S_(N) ^(IV)and assume that column vectors form a transform basis.

Referring to FIG. 6 above, the transform configuration groups may bedetermined based on the prediction mode and the number of groups may bea total of six groups G0 to G5. In addition, G0 to G4 correspond to acase where intra prediction is applied, and G5 represents transformcombinations (or transform sets and transform combination sets) appliedto the residual block generated by the inter prediction.

One transform combination may be constituted by a horizontal transform(or row transform) applied to rows of a corresponding 2D block and avertical transform (or column transform) applied to columns.

Here, each of all of the transform configuration groups may have fourtransform combination candidates. The four transform combinations may beselected or determined through transform combination indexes of 0 to 3and the transform combination index may be encoded and transmitted fromthe encoder to the decoder.

As an embodiment, the residual data (or residual signal) obtainedthrough the intra prediction may have different statisticalcharacteristics according to the intra prediction mode. Therefore, asillustrated in FIG. 6, transforms other than a general cosine transformmay be applied to each intra prediction mode.

Referring to FIG. 6 above, a case of using 35 intra prediction modes anda case of using 67 intra prediction modes are illustrated. A pluralityof transform combinations may be applied to each transform configurationgroup divided in each intra prediction mode column. For example, theplurality of transform combinations may be constituted by four (rowdirection transforms and column direction transforms) combinations. As aspecific example, DST-7 and DST-5 may be applied in a row (horizontal)direction and a column (vertical) direction in group 0, and as a result,a total of four combinations are available.

Since a total of transform kernel combinations may be applied to eachintra prediction mode, a transform combination index for selecting oneof the transform kernel combinations may be transmitted every transformunit. In the present disclosure, the transform combination index may becalled MTS index and expressed as mtx_idx.

Further, in addition to the transform kernels presented in FIG. 6 above,a case where DCT2 is optimal for both the row direction and the columndirection due to characteristics of the residual signal may occur.Accordingly, the MTS flag is defined for each coding unit to adaptivelyperform the transform. Here, when the MTS flag is 0, DCT2 may be appliedto both the row direction and the column direction and when the MTS flagis 1, one of four combinations may be selected or determined through theMTS index.

As an embodiment, when the MTS flag is 1, if the number of non-zerotransform coefficients for one transform unit is not greater than athreshold, the DST-7 may be applied both the row direction and thecolumn direction is not applied without applying the transform kernelsof FIG. 6 above. For example, the threshold may be set to 2, which maybe set differently based on the block size or the size of the transformunit. This is also applicable to other embodiments in the specification.

As an embodiment, if the number of non-zero transform coefficients isnot greater than the threshold by first parsing the transformcoefficient values, an additional information transmission amount may bereduced by applying the DST-7 without parsing the MTS index.

As an embodiment, when the MTS flag is 1, if the number of non-zerotransform coefficients is greater than the threshold for one transformunit, the MTS index may be parsed and the horizontal transform and thevertical transform may be determined based on the MTS index.

As an embodiment, the MTS may be applied only when both a width and aheight of the transform unit is equal to or smaller than 32.

As an embodiment, FIG. 6 above may be preconfigured through off-linetraining.

As an embodiment, the MTS index may be defined as one index which maysimultaneously indicate the horizontal transform and the verticaltransform.

Alternatively, the MTS index may separately define a horizontaltransform index and a vertical transform index.

As an embodiment, the MTS flag or the MTS index may be defined at atleast one level of a sequence, a picture, a slice, a block, a codingunit, a transform unit, or a prediction unit. For example, the MTS flagor the MTS index may be defined at at least one level of a sequenceparameter set (SPS), the coding unit, or the transform unit.

As another embodiment, the transform combination (horizontal transformor vertical transform) corresponding to the transform index may beconfigured without dependence on the MTS flag, the prediction mode,and/or a block shape. For example, the transform combination may beconfigured by at least one of DCT2, DST7, and/or DCT8. As a specificexample, when the transform index is 0, 1, 2, 3, or 4, each transformcombination may be (DCT2, DCT2), (DST7, DST7), (DCT8, DST7), (DST7,DCT8), or (DCT8, DCT8).

FIG. 7 is a flowchart showing an encoding process in which MultipleTransform Selection (MTS) is performed as an embodiment to which thepresent disclosure is applied.

In the present disclosure, an embodiment in which transforms are aseparately applied to the horizontal direction and the verticaldirection is basically described, but the transform combination may beconfigured as non-separable transforms.

Alternatively, the transform combination may be configured by a mixtureof separable transforms and non-separable transforms. In this case, whenthe non-separable transform is used, row/column transform selection orhorizontal/vertical direction selection may not be required and onlywhen the separable transform is selected, the transform combinations ofFIG. 6 above may be used.

Further, schemes proposed by the present disclosure may be appliedregardless of the primary transform or the secondary transform. That is,there is no limit that the schemes should be applied only to any one ofboth the primary transform and the secondary transform and the schemesmay be applied to both the primary transform and the secondarytransform. Here, the primary transform may mean a transform fortransforming the residual block first and the secondary transform maymean a transform for applying the transform to the block generated as aresult of the primary transform.

First, the encoder may determine the transform configuration groupcorresponding to the current block. Here, the transform configurationgroup may mean the transform configuration group of FIG. 6 above and thepresent disclosure is not limited thereto and the transformconfiguration group may be constituted by other transform combinations.

The encoder may perform a transform for candidate transform combinationsavailable in the transform configuration group (S720).

As a result of performing the transform, the encoder may determine orselect a transform combination having a smallest rate distortion (RD)cost (S730).

The encoder may encode the transform combination index corresponding tothe selected transform combination (S740).

FIG. 8 is a flowchart showing a decoding process in which MultipleTransform Selection (MTS) is performed as an embodiment to which thepresent disclosure is applied.

First, the decoder may determine the transform configuration group forthe current block (S810).

The decoder may parse (or obtain) the transform combination index fromthe video signal and here, the transform combination index maycorrespond to any one of the plurality of transform combinations in thetransform configuration group (S820). For example, the transformconfiguration group may include Discrete Sine Transform type (DST) 7 andDiscrete Cosine Transform type (DST) 8. The transform combination indexmay be referred to as the MTS index.

As an embodiment, the transform configuration group may be configuredbased on at least one of the prediction mode, the block size, or theblock shape of the current block.

The decoder may derive the transform combination corresponding to thetransform combination index (S830). Here, the transform combination mayinclude the horizontal transform and the vertical transform, and mayinclude at least one of the DST-7 or the DCT-8.

Further, the transform combination may mean the transform combinationdescribed in FIG. 6 above, but the present disclosure is not limitedthereto. That is, the transform combination may be configured by othertransform combinations depending on other embodiments in the presentdisclosure.

The decoder may perform the inverse transform for the current blockbased on the transform combination (S840). When the transformcombination includes the row (horizontal) transform and the column(vertical) transform, the column (vertical) transform may be appliedafter applying the row (horizontal) transform first. However, thepresent disclosure is not limited thereto and the transform order may bereversed or when the transform combination includes the non-separabletransforms, the non-separable transform may be immediately applied.

As an embodiment, when the vertical transform or the horizontaltransform is the DST-7 or the DCT-8, the inverse transform of the DST-7or the inverse transform of the DCT-8 may be applied to each row andthen applied to each row.

As an embodiment, in respect to the vertical transform or the horizontaltransform, different transform may be applied to each row and/or eachcolumn.

As an embodiment, the transform combination index may be acquired basedon the MTS flag indicating whether the MTS is performed. That is, thetransform combination index may be obtained when the MTS is performedaccording to the MTS flag.

As an embodiment, the decoder may check whether the number of non-zerotransform coefficients is greater than the threshold. In this case, thetransform combination index may be obtained when the number of non-zerotransform coefficients is greater than the threshold.

As an embodiment, the MTS flag or the MTS index may be defined at atleast one level of a sequence, a picture, a slice, a block, a codingunit, a transform unit, or a prediction unit.

As an embodiment, the inverse transform may be applied only when boththe width and the height of the transform unit is equal to or smallerthan 32.

On the other hand, as another embodiment, a process of determining thetransform configuration group and a process of parsing the transformcombination index may be performed at the same time. Alternatively, stepS810 above may be preconfigured and omitted in the encoder and/or thedecoder.

FIG. 9 is a flowchart for describing a process of encoding an MTS flagand an MTS index as an embodiment to which the present disclosure isapplied.

The encoder may determine whether the Multiple Transform Selection (MTS)is applied to the current block (S910).

When the Multiple Transform Selection (MTS) is applied, the encoder mayencode MTS flag=1 (S920).

In addition, the encoder may determine the MTS index based on at leastone of the prediction mode, the horizontal transform, and the verticaltransform of the current block (S930). Here, the MTS index may mean anindex indicating any one of the plurality of transform combinations foreach intra prediction mode and the MTS index may be transmitted for eachtransform unit.

When the MTS index is determined, the encoder may encode the MTS index(S940).

On the other hand, when the Multiple Transform Selection (MTS) is notapplied, the encoder may encode MTS flag=0 (S950).

FIG. 10 is a flowchart for describing a decoding process in whichhorizontal transform or vertical transform is applied to a row or acolumn based on an MTS flag and an MTS index as an embodiment to whichthe present disclosure is applied.

The decoder may parse the MTS flag from the bitstream (S1010). Here, theMTS flag may indicate whether the Multiple Transform Selection (MTS) isapplied to the current block.

The decoder may determine whether the Multiple Transform Selection (MTS)is applied to the current block based on the MTS flag (S1020). Forexample, it may be checked whether the MTS flag is 1.

When the MTS flag is 1, the decoder may check whether the number ofnon-zero transform coefficients is greater than (or equal to or greaterthan) the threshold (S1030). For example, the threshold may be set to 2,which may be set differently based on the block size or the size of thetransform unit.

When the number of non-zero transform coefficients is greater than thethreshold, the decoder may parse the MTS index (S1040). Here, the MTSindex may mean any one of the plurality of transform combinations foreach intra prediction mode or inter prediction mode and the MTS indexmay be transmitted for each transform unit. Alternatively, the MTS indexmay mean an index indicating any one transform combination defined in apreconfigured transform combination table and here, the preconfiguredtransform combination table may mean FIG. 6 above, but the presentdisclosure is limited thereto.

The decoder may derive or determine the horizontal transform and thevertical transform based on at least one of the MTS index and theprediction mode (S1050).

Alternatively, the decoder may derive the transform combinationcorresponding to the MTS index. For example, the decoder may derive ordetermine the horizontal transform and the vertical transformcorresponding to the MTS index.

Meanwhile, when the number of non-zero transform coefficients is notgreater than the threshold, the decoder may apply a preconfiguredvertical inverse transform for each column (S1060). For example, thevertical inverse transform may be the inverse transform of the DST7.

In addition, the decoder may apply a preconfigured horizontal inversetransformation for each row (S1070). For example, the horizontal inversetransform may be the inverse transform of the DST7. That is, when thenumber of non-zero transform coefficients is not greater than thethreshold, a transform kernel preconfigured by the encoder or decodermay be used. For example, the transform kernel that is not defined inthe transform combination table illustrated in FIG. 6 above, but iswidely used may be used.

Meanwhile, when the MTS flag is 0, the decoder may apply thepreconfigured vertical inverse transform for each column (S1080). Forexample, the vertical inverse transform may be the inverse transform ofthe DCT2.

In addition, the decoder may apply the preconfigured horizontal inversetransformation for each row (S1090). For example, the horizontal inversetransform may be the inverse transform of the DCT2. That is, when theMTS flag is 0, the transform kernel preconfigured by the encoder ordecoder may be used. For example, the transform kernel that is notdefined in the transform combination table illustrated in FIG. 6 above,but is widely used may be used.

FIG. 11 is a flowchart of performing inverse transform based on atransform related parameter as an embodiment to which the presentdisclosure is applied.

The decoder to which the present disclosure is applied may obtainsps_mts_intra_enabled_flag or sps_mts_inter_enabled_flag (S1110). Here,sps_mts_intra_enabled_flag indicates whether tu_mts_flag exists in aresidual coding syntax of an intra coding unit. For example, whensps_mts_intra_enabled_flag=0, tu_mts_flag does not exist in the residualcoding syntax of the intra coding unit and whensps_mts_intra_enabled_flag=0, tu_mts_flag exists in the residual codingsyntax of the intra coding unit. In addition, sps_mts_inter_enabled_flagindicates whether tu_mts_flag exists in the residual coding syntax ofthe inter coding unit. For example, when sps_mts_inter enabled flag=0,tu_mts_flag does not exist in the residual coding syntax of the intracoding unit and when sps_mts_inter enabled_flag=0, tu_mts_flag exists inthe residual coding syntax of the inter coding unit.

The decoder may obtain tu_mts_flag based on sps_mts_intra_enabled_flagor sps_mts_inter_enabled_flag (S1120). For example, whensps_mts_intra_enabled_flag=1 or sps_mts_inter_enabled_flag=1, thedecoder may obtain tu_mts_flag. Here, tu_mts_flag indicates whethermultiple transform selection (hereinafter, referred to as “MTS”) isapplied to a residual sample of a luma transform block. For example,when tu_mts_flag=0, the MTS is not applied to the residual sample of theluma transform block and when tu_mts_flag=1, the MTS is applied to theresidual sample of the luma transform block.

As another example, at least one of the embodiments of the presentdocument may be applied to the tu_mts_flag.

The decoder may obtain mts_idx based on tu_mts_flag (S1130). Forexample, when tu_mts_flag=1, the decoder may obtain mts_idx. Here,mts_idx indicates which transform kernel is applied to luma residualsamples along the horizontal and/or vertical direction of a currenttransform block.

For example, at least one of the embodiments of the present document maybe applied to mts_idx. As a specific example, at least one of theembodiments of FIG. 6 above may be applied.

The decoder may derive the transform kernel corresponding to mts_idx(S1140). For example, the transform kernel corresponding to the mts_idxmay be defined by being divided into the horizontal transform and thevertical transform.

As another example, different transform kernels may be applied to thehorizontal transform and the vertical transform. However, the presentdisclosure is not limited thereto, and the same transform kernel may beapplied to the horizontal transform and the vertical transform.

As an embodiment, mts_idx may be defined as shown in Table 1 below.

TABLE 1 mts_idx[x0][y0] trTypeHor trTypeVer 0 0 0 1 1 1 2 2 1 3 1 2 4 22

In addition, the decoder may perform the inverse transform based on thetransform kernel (S1150).

As another embodiment of the present disclosure, a decoding process ofperforming the transform process is described.

The decoder may check a transform size nTbS (S10). Here, the transformsize nTbS may be a variable representing a horizontal sample size ofscaled transform coefficients.

The decoder may check a transform kernel type trType (S20). Here, thetransform kernel type trType may be a variable representing the type oftransform kernel and various embodiments of the present disclosure maybe applied. The transform kernel type trType may include a horizontaltransform kernel type trTypeHor and a vertical transform kernel typetrTypeVer.

Referring to Table 1 above, when the transform kernel type trType is 0,the transform kernel type may represent DCT2, when the transform kerneltype trType is 1, the transform kernel type may represent DST7, and whenthe transform kernel type trType is 2, the transform kernel type mayrepresent DCT8.

The decoder may perform a transform matrix multiplication based on atleast one of the transform size nTbS or the transform kernel type (S30).

As another example, when the transform kernel type is 1 and thetransform size is 4, a predetermined transform matrix 1 may be appliedwhen performing the transform matrix multiplication.

As another example, when the transform kernel type is 1 and thetransform size is 8, a predetermined transform matrix 2 may be appliedwhen performing the transform matrix multiplication.

As another example, when the transform kernel type is 1 and thetransform size is 16, a predetermined transform matrix 3 may be appliedwhen performing the transform matrix multiplication.

As another example, when the transform kernel type is 1 and thetransform size is 32, a predefined transform matrix 4 may be appliedwhen performing the transform matrix multiplication.

Similarly, when the transform kernel type is 2 and the transform size is4, 8, 16, or 32, predefined transform matrices 5, 6, 7, and 8 may beapplied, respectively.

Here, each of the predefined transform matrices 1 to 8 may correspond toany one of various types of transform matrices. As an example, thetransform matrix of the type illustrated in FIG. 6 above may be applied.

The decoder may derive a transform sample based on transform matrixmultiplication (S40).

Each of the above embodiments may be used, but the present disclosure isnot limited thereto, and may be used in combination with the aboveembodiments and other embodiments of the present disclosure.

FIG. 12 is a table showing allocation of a transform set for each intraprediction mode in an NSST as an embodiment to which the presentdisclosure is applied.

Non-Separable Secondary Transform (NSST)

The secondary transform unit may apply the secondary transform to aprimary transformed signal and here, the secondary transform may bedefined in the table in the encoder and/or the decoder.

As an embodiment, the secondary transform may conditionally adopt anon-separable secondary transform (hereinafter, referred to as ‘NSST’).For example, the NSST may be applied only to the intra prediction blockand may have a transform set applicable to each prediction mode group.

Here, the prediction mode group may be configured based on symmetry withrespect to a prediction direction. For example, since prediction mode 52and prediction mode 16 are symmetrical based on prediction mode 34(diagonal direction), the same transform set may be applied by formingone group. In this case, when the transform for prediction mode 52 isapplied, input data is transposed and then applied because predictionmode 52 has the same transform set as prediction mode 16.

Meanwhile, since the symmetry for the direction does not exist in thecase of a planar mode and a DC mode, each mode has a different transformset and the corresponding transform set may be constituted by twotransforms. In respect to the remaining direction modes, each transformset may be constituted by three transforms. However, the presentdisclosure is not limited thereto, and each transform set may beconstituted by a plurality of transforms.

FIG. 13 is a calculation flow diagram for Givens rotation as anembodiment to which the present disclosure is applied.

As another embodiment, the NSST may not be applied to the entire primarytransformed block but may be applied only to a top-left 8×8 region. Forexample, when the block size is 8×8 or more, 8×8 NSST is applied andwhen the block size is less than 8×8, 4×4 NSST is applied and in thiscase, the block is divided into 4×4 blocks and then, the 4×4 NSST isapplied to each of the divided blocks.

As another embodiment, even in the case of 4×N /N×4 (N>=16), the 4×4NSST may be applied.

Since both the 8×8 NSST and the 4×4 NSST follow a transformationcombination configuration described in the present disclosure and arethe non-separable transforms, the 8×8 NSST receives 64 data and outputs64 data and the 4×4 NSST has 16 inputs and 16 outputs.

Both the 8×8 NSST and the 4×4 NSST are configured by a hierarchicalcombination of Givens rotations. A matrix corresponding to one Givensrotation is shown in Equation 4 below and a matrix product is shown inEquation 5 below.

$\begin{matrix}{R_{\theta} = \begin{bmatrix}{\cos \; \theta} & {{- s}{in}\; \theta} \\{\sin \; \theta} & {\cos \; \theta}\end{bmatrix}} & \left\lbrack {{Equation}\mspace{14mu} 4} \right\rbrack \\{{t_{m} = {{x_{m}\cos \; \theta} - {x_{n}\sin \; \theta}}}{t_{n} = {{x_{m}\sin \; \theta} + {x_{n}\cos \; \theta}}}} & \left\lbrack {{Equation}\mspace{14mu} 5} \right\rbrack\end{matrix}$

As illustrated in FIG. 13 above, since one Givens rotation rotates twodata, in order to process 64 data (for the 8×8 NSST) or 16 data (for the4×4 NSST), a total of 32 or 8 Givens rotations are required.

Therefore, a bundle of 32 or 8 is used to form a Givens rotation layer.Output data for one Givens rotation layer is transferred as input datafor a next Givens rotation layer through a determined permutation.

FIG. 14 illustrates one round configuration in 4×4 NSST constituted by agivens rotation layer and permutations as an embodiment to which thepresent disclosure is applied.

Referring to FIG. 14 above, it is illustrated that four Givens rotationlayers are sequentially processed in the case of the 4×4 NSST. Asillustrated in FIG. 14 above, the output data for one Givens rotationlayer is transferred as the input data for the next Givens rotationlayer through a determined permutation (i.e., shuffling).

As illustrated in FIG. 14 above, patterns to be permutated are regularlydetermined and in the case of the 4×4 NSST, four Givens rotation layersand the corresponding permutations are combined to form one round.

In the case of the 8×8 NSST, six Givens rotation layers and thecorresponding permutations form one round. The 4×4 NSST goes through tworounds and the 8×8 NSST goes through four rounds. Different rounds usethe same permutation pattern, but applied Givens rotation angles aredifferent. Accordingly, angle data for all Givens rotations constitutingeach transform need to be stored.

As a last step, one permutation is further finally performed on the dataoutput through the Givens rotation layers, and corresponding permutationinformation is stored separately for each transform. In forward NSST,the corresponding permutation is performed last and in inverse NSST, acorresponding inverse permutation is applied first on the contrarythereto.

In the case of the inverse NSST, the Givens rotation layers and thepermutations applied to the forward NSST are performed in the reverseorder and rotation is performed by taking a negative value even for anangle of each Givens rotation.

FIGS. 15A and 15B is a block diagram for describing operations of aforward reduced transform and an inverse reduced transform as anembodiment to which the present disclosure is applied.

Reduced Secondary Transform (RST)

When it is assumed that an orthogonal matrix representing one transformhas an N×N form, a reduced transform (hereinafter, referred to as ‘RT’)leaves only R transform basis vectors among N transform basis vectors(R<N). A matrix for forward RT generating the transform coefficients isgiven by Equation 6 below.

$\begin{matrix}{T_{R \times N} = \begin{bmatrix}t_{11} & t_{12} & t_{13} & \ldots & t_{1\; N} \\t_{21} & t_{22} & t_{23} & \; & t_{2\; N} \\\; & \vdots & \; & \ddots & \vdots \\t_{R\; 1} & t_{R\; 2} & t_{R\; 3} & \ldots & t_{RN}\end{bmatrix}} & \left\lbrack {{Equation}\mspace{14mu} 6} \right\rbrack\end{matrix}$

Since a matrix for an inverse RT becomes a transpose matrix of theforward RT matrix, the application of the forward RT and the inverse RTis illustrated as illustrated in FIGS. 15A and 15B above.

When a case of applying the RT to the top-left 8×8 block of thetransform block which goes through the primary transform is assumed, theRT may be referred to as an 8×8 reduced secondary transform (8×8 RST).

When the R value of Equation 6 above is 16, the forward 8×8 RST has a16×64 matrix form and the inverse 8×8 RST has a 64×16 matrix form.

Further, the transform set configuration which is the same as thatillustrated in FIG. 12 above may be applied even to the 8×8 RST. Thatis, a corresponding 8×8 RST may be applied according to the transformset in FIG. 12 above.

As an embodiment, when one transform set includes two or threetransforms according to the intra prediction mode in FIG. 12 above, oneof a maximum of 4 transforms including a case of not applying thesecondary transform may be configured to be selected. Here, onetransform may be regarded as an identity matrix.

When indexes of 0, 1, 2, and 3 are assigned to the four transforms,respectively, a syntax element called an NSST index may be signaled foreach transform block, thereby designating a corresponding transform.That is, in the case of the NSST, the 8×8 NSST may be designated for the8×8 top-left block through the NSST index and the 8×8 RST may bedesignated in an RST configuration. Further, in this case, index 0 maybe allocated to a case where the identity matrix, i.e., the secondarytransform is not applied.

When the forward 8×8 RST shown in Equation 6 above is applied, 16 validtransform coefficients are generated, and as a result, it may beregarded that 64 input data constituting an 8×8 region are reduced to 16output data. From the perspective of a two-dimensional region, only aone-quarter region is filled with the valid transform coefficient.Accordingly, a 4×4 top-left region in FIG. 16 may be filled with 16output data obtained by applying the forward 8×8 RST.

FIG. 16 is a diagram illustrating a process of performing an inversescan from 64^(th) to 17^(th) according to an inverse scan order as anembodiment to which the present disclosure is applied.

FIG. 16 above illustrates scanning from the 17^(th) coefficient to the64^(th) coefficient when the forward scanning order starts from 1 (inthe forward scan order). However, FIG. 16 above illustrates the inversescan and this illustrates performing the inverse scanning from the64^(th) coefficient to the 17^(th) coefficient.

Referring to FIG. 16 above, the top-left 4×4 region is a region ofinterest (ROI) to which the valid transform coefficient is allocated andthe remaining region is empty. That is, a value of 0 may be allocated tothe remaining region by default.

If there is a valid transform coefficient other than 0 in a region otherthan the ROI region of FIG. 16 above, this means that the 8×8 RST is notapplied, and as a result, in this case, NSST index coding correspondingthereto may be omitted.

Conversely, if there is no non-zero transform coefficient in the regionother than the ROI region of FIG. 16 above (if the 8×8 RST is applied,when 0 is allocated to the region other than the ROI), there is apossibility that the 8×8 RST will be applied, and as a result, the NSSTindex may be coded.

As such, conditional NSST index coding may be performed after theresidual coding process because it is necessary to check the existenceof the non-zero transform coefficient.

The present disclosure provides a method for designing an RST andassociated optimization methods which may be applied to the 4×4 blockfrom an

RST structure. The embodiments disclosed in the present disclosure maybe applied to the 8×8 RST or another type of transform in addition tothe 4×4 RST.

FIGS. 17A through 17C illustrate three forward scan orders for atransform coefficient block (transform block) as an embodiment to whichthe present disclosure is applied.

Embodiment 1: RST Applicable to 4×4 Block

A non-separable transform that may be applied to one 4×4 block is a16×16 transform. That is, when data elements constituting the 4×4 blockare arranged in a row-first or column-first order, a 16×1 vector is usedto apply the non-separable transform.

The forward 16×16 transform is constituted by 16 row-wise transformedbasis vectors and when an inner product is applied to the 16×1 vectorand each transform basis vector, the transform coefficient for thetransform basis vector is obtained. A process of obtaining transformcoefficients corresponding to all of 16 transform basis vectors isequivalent to multiplying the 16×16 non-separable transform matrix bythe input 16×1 vector.

The transform coefficients obtained by the matrix product have a 16×1vector form, and statistical characteristics may be different for eachtransform coefficient. For example, when a 16×1 transform coefficientvector is constituted by a 0^(th) element to a 15^(th) element, avariance of the 0^(th) element may be greater than the variance of the15^(th) element. In other words, as the element is positioned former, acorresponding variance value of the element is larger, so that theelement may have a larger energy value.

When the inverse 16×16 non-separable transform is applied from the 16×1transform coefficient, an original 4×4 block signal may bereconstructed. When the forward 16×16 non-separable transform is anorthonormal transform, the corresponding inverse 16×16 transform may beobtained through the transpose matrix for the forward 16×16 transform.

When the 16×1 transform coefficient vector is multiplied by the inverse16×16 non-separable transform matrix, data in the form of the 16×1vector may be obtained and when the obtained data are arranged in therow-first or column-first order which is first applied, the 4×4 blocksignal may be reconstructed.

As described above, elements constituting the 16×1 transform coefficientvector may have different statistical characteristics.

If transform coefficients arranged at a former side (close to an 0^(th)element) have larger energy, a signal may be reconstructed, which isquite close to the original signal even though the inverse transform isapplied to some transform coefficients which first appear without usingall transform coefficients. For example, when the inverse 16×16non-separable transform is constituted by 16 column basis vectors, onlyL column basis vectors are left to form a 16×L matrix. In addition, whena 16×L matrix and an L×1 vector are multiplied by each other after onlyL important transform coefficients are left among the transformcoefficients (L×1 vector), when the 16×L matrix and the L×1 vector aremultiplied by each other, the 16×1 vector may be reconstructed, whichhas a small error from original input 16×1 vector data.

As a result, since only L coefficients are used for data reconstruction,the L×1 transform coefficient vector is obtained instead of the 16×1transform coefficient vector even when obtaining the transformcoefficient. That is, when an L×16 transform is configured by selectingL corresponding row-wise transform vectors in the forward 16×16non-separable transform matrix and the configured L×16 transform is thenmultiplied by the 16×1 input vector, L important transform coefficientsmay be obtained.

The L value has a range of 1 L<16 and in general, L vectors may beselected by an arbitrary method among 16 transform basis vectors, but itmay be advantageous in terms of coding efficiency to select transformbasis vectors having a high importance in terms of energy of the signalfrom the viewpoint of coding and decoding.

Embodiment 2: Configuration of Application Region of 4×4 RST andArrangement of Transform Coefficients

The 4×4 RST may be applied as the secondary transform, and may beapplied secondarily to a block to which a primary transform such asDCT-type 2 is applied. When the size of the block to which the primarytransform is applied is N×N, the size of the block to which the primarytransform is applied is generally larger than 4×4. Therefore, whenapplying the 4×4 RST to the N×N block, there may be two methods asfollows.

Embodiment 2-1) The 4×4 RST is not applied to all N×N regions, but maybe applied only to some regions. For example, the 4×4 RST may be appliedonly to the top-left M×M region (M≤N).

Embodiment 2-2) A region to which the secondary transform is to beapplied may be divided into 4×4 blocks and then the 4×4 RST may beapplied to each divided block.

As an embodiment, embodiments 2-1) and 2-2) may be mixed and applied.For example, only the top-left M×M region may be divided into 4×4 blocksand then the 4×4 RST may be applied.

As an embodiment, the secondary transform may be applied only to thetop-left 8×8 region and when N×N block is equal to or larger than 8×8,the 8×8 RST may be applied and when the N×N block is smaller than 8×8(4×4, 8×4, and 4×8), the N×N block may be divided into 4×4 blocks andthen the 4×4 RST may be applied to each of 4×4 blocks as in embodiment2-2) above. Further, even in the case of 4×N/N×4 (N>=16), the 4×4 NSSTmay be applied.

When L (1 L<16) transform coefficients are generated after applying the4×4 RST, a degree of freedom for how the L transform coefficients arearranged is generated. However, since there will be a predeterminedorder when processing the transform coefficient in a residual codingstep, coding performance may vary depending on how the L transformcoefficients are arranged in a 2D block.

For example, in the case of residual coding of HEVC, coding starts froma position farthest from a DC position. This is to enhance the codingperformance by using a fact that a quantized coefficient value is zeroor is close to zero as moving away from the DC position.

Therefore, it may be advantageous in terms of the coding performance toarrange more important coefficients with high energy even for the Ltransform coefficients so that the L transform coefficients are codedlater in the order of residual coding.

FIGS. 17A through 17C illustrate three forward scan orders in units of a4×4 transform block (coefficient group (CG)) applied in HEVC. Theresidual coding follows the reverse order of the scan order of FIGS. 17Athrough 17C above (i.e., coding is performed in the order of 16 to 1).

Since three scan orders presented in FIGS. 17A through 17C above areselected according to the intra prediction mode, the present disclosuremay be configured to determine the scan order according to the intraprediction mode similarly even for the L transform coefficients.

FIG. 18 illustrates positions of valid transform coefficients and aforward scan order for each of 4×4 blocks when diagonal scan is appliedand 4×4 RST is applied in top-left 4×8 blocks as an embodiment to whichthe present disclosure is applied.

When following a diagonal scan order in FIGS. 17A through 17C above anddividing the top-left 4×8 block into 4×4 blocks and applying the 4×4 RSTto each 4×4 block, if the L value is 8 (i.e., if only 8 transformcoefficients among 16 transform coefficients are left), the transformcoefficients may be positioned as in FIG. 18 above.

Only half of respective 4×4 blocks may have the transform coefficientsand a value of 0 may be applied to locations marked with X by default.

Accordingly, the residual coding may be applied by arranging L transformcoefficients for each 4×4 block according to the scan order illustratedin FIGS. 17A through 17C above and assuming that 16−L remainingpositions of each 4×4 block are filled with zero.

FIGS. 19A and 19B illustrates a case where valid transform coefficientsof two 4×4 blocks are combined into one 4×4 block when diagonal scan isapplied and 4×4 RST is applied in top-left 4×8 blocks as an embodimentto which the present disclosure is applied.

Referring to FIGS. 19A and 19B above, L transform coefficients arrangedin two 4×4 blocks may be combined into one. In particular, when the Lvalue is 8, since the transform coefficients of two 4×4 blocks arecombined while completely filling one 4×4 block, no transformcoefficient is also left in the other one 4×4 block.

Accordingly, since most residual coding is not required with respect tothe empty 4×4 block, corresponding coded_sub_block_flag may be codedwith 0.

Further, as an embodiment of the present disclosure, various schemes maybe applied even to how transform coefficients of two 4×4 blocks aremixed. The transform coefficients may be combined according to a randomorder, but the present disclosure may provide the following methods.

1) Transform coefficients of two 4×4 blocks are alternately mixed in thescan order. That is, in FIG. 18 above, when the transform coefficientsfor the top block are c₀ ^(u), c₁ ^(u), c₂ ^(u), c₃ ^(u), c₄ ^(u), c₅^(u), c₆ ^(u), and c₇ ^(u) and the transform coefficients for the bottomblock are c₀ ^(l), c₁ ^(l), c₂ ^(l), c₃ ^(l), c₄ ^(l), c₅ ^(l), c₆ ^(l),and c₇ ^(l), the transform coefficients may be mixed alternately one byone like c₀ ^(u), c₀ ^(l), c₁ ^(u), c₁ ^(l), c₂ ^(u), c₂ ^(l), . . . ,c₇ ^(u), c₇ ^(l). Alternatively, the orders of c_(*) ^(u) and c_(*) ^(l)may be changed. That is, c_(*) ^(l) may be configured to come out first.

2) The transform coefficients for a first 4×4 block may be firstarranged and then the transform coefficients for a second 4×4 block maybe arranged.

That is, the transform coefficients may be connected and arranged likec₀ ^(u), c₁ ^(u), . . . , c₇ ^(u), c₀ ^(l), c₁ ^(l), . . . , c₇ ^(l).Alternatively, the order may be changed like c₀ ^(l), c₁ ^(l), . . . ,c₇ ^(l), c₀ ^(u), c₁ ^(u), . . . , c₇ ^(u).

Embodiment 3: Method for Coding NSST Index for 4×4 RST

When the 4×4 RST is applied as illustrated in FIG. 18 above, L+1-th to16-th may be filled with the 0 value according to the transformcoefficient scan order for each of the 4×4 blocks.

Accordingly, when a non-zero value is generated at L+1-th to 16-thpositions even in one of two 4×4 blocks, it may be known that this caseis a case where the 4×4 RST is not applied.

When the 4×4 RST also has a structure in which one of the transform setsprepared as the NSST is selected and applied, a transform index (whichmay be referred to as an NSST index in the embodiment) for whichtransform to apply may be signaled.

It is assumed that any decoder may know the NSST index through bitstreamparsing and the parsing is performed after residual decoding.

When the residual decoding is performed and it is confirmed that atleast one non-zero transform coefficient exists between L+1-th and16-th, the 4×4 RST is not applied, and thus the NSST index may beconfigured to not be parsed.

Accordingly, the NSST index is selectively parsed only when necessary toreduce signaling cost.

If the 4×4 RST is applied to a plurality of 4×4 blocks in a specificregion as illustrated in FIG. 18 above (for example, the same 4×4 RSTmay be applied to all of the plurality of 4×4 blocks or different 4×4RSTs may be applied), the 4×4 RST applied to the all 4×4 blocks may bedesignated through one NSST index. In this case, the same 4×4 RST may bedesignated or the 4×4 RST applied to each of all 4×4 blocks may bedesignated.

Since whether the 4×4 RST is applied to the all 4×4 blocks by one NSSTindex, it may be checked whether non-zero transform coefficients existat L+1-th to 16-th locations for the all 4×4 blocks during a residualdecoding process. As a checking result, when the non-zero transformcoefficient exists at a location (L+1-th to 16-th locations) which isnot accepted even in one 4×4 block, the NSST index may be configured tonot be coded.

The NSST index may be signaled separately for the luma block and thechroma block, and in the case of the chroma block, separate NSST indexesmay be signaled for Cb and Cr, and one NSST index may be shared.

When one NSST index is shared for Cb and Cr, 4×4 RST designated by thesame NSST index may be applied. In this case, the 4×4 RSTs for Cb and Crthemselves may be the same or the NSST index may be the same, butseparate 4×4 RSTs may be provided.

To apply the conditional signaling to the shared NSST index, it ischecked whether non-zero transform coefficients exist at L+1-th to 16-thfor all 4×4 blocks for Cb and Cr and when the non-zero transformcoefficient exists, the NSST index may be configured to not be signaled.

As illustrated in FIGS. 19A and 19B above, even for a case where thetransform coefficients for two 4×4 blocks are combined, it is checkedwhether the non-zero transform coefficient exists at a location wherethe valid transform coefficient does not exist when the 4×4 RST isapplied and then it may be determined whether the NSST is signaled.

For example, as illustrated in FIG. 19B above, when the L value is 8 andthe valid transform coefficients do not exist for one 4×4 blocks at thetime of applying the 4×4 RST (a block marked with X),coded_sub_block_flag of a block where the valid transform coefficientsdo not exist may be checked. In this case, when coded_sub_block_flag is1, the NSST index may be configured to not be signaled.

Embodiment 4: Optimization Method for Case Where Coding for NSST Indexis Performed Before Residual Coding

When coding for the NSST index is performed before residual coding,whether to apply the 4×4 RST is predetermined, and as a result, residualcoding may be omitted for locations where 0 is allocated to thetransform coefficient.

Here, whether to apply the 4×4 RST may be configured to be known throughthe NSST index. For example, when the NSST index is 0, the 4×4 RST isnot applied.

Alternatively, the NSST index may be signaled through a separate syntaxelement (e.g., NSST flag). For example, if a separate syntax element iscalled the NSST flag, the NSST flag is parsed first to determine whetherthe 4×4 RST is applied, and if the NSST flag value is 1, the residualcoding may be omitted for locations where no valid transform coefficientmay exist.

As an embodiment, when the residual coding is performed, a last non-zerotransform coefficient location on the TU is coded first. When the codingfor the NSST index is performed after coding the last non-zero transformcoefficient location and it is assumed that the 4×4 RST is applied tothe location of the last non-zero transform coefficient, if the lastnon-zero transform coefficient location is determined as a locationwhere the non-zero transform coefficient may not be generated, the 4×4RST may be configured not to be applied to the last non-zero transformcoefficient location without coding the NSST index.

For example, since in the case of locations marked with X in FIG. 18above, valid transformation coefficients are not positioned when the 4×4RST is applied (e.g., the locations may be filled with zero values),when the last non-zero transform coefficient is positioned in the regionmarked with X, the coding for the NSST index may be omitted. When thelast non-zero transform coefficient is not positioned in the regionmarked with X, the coding of the NSST index may be performed.

As an embodiment, when it is checked whether to apply the 4×4 RST byconditionally coding the NSST index after the coding for the lastnon-zero transform coefficient location, the remaining residual codingportion may be processed by two following schemes.

1) In case of not applying the 4×4 RST, general residual coding is keptas it is. That is, the coding is performed under the assumption that thenon-zero transform coefficient may exist at any location from thenon-zero transform coefficient location to DC.

2) When the 4×4 RST is applied, since no transform coefficient existsfor a specific location or a specific 4×4 block (e.g., an X location ofFIG. 18 above, which may be filled with 0 by default), the residual forthe corresponding location or block may not be performed.

For example, in a case of reaching the location marked with X in FIG. 18above, coding for sig_coeff_flag may be omitted. Here, sig_coeff flagmeans a flag indicating whether the non-zero transform coefficientexists at a corresponding location.

When transform coefficients of two blocks are combined as illustrated inFIGS. 19A and 19B above, the coding for coded_sub_block_flag may beomitted for the 4×4 blocks allocated with 0 and a corresponding valuemay be derived to 0 and all corresponding 4×4 blocks may be derived tozero values without separate coding.

In a case where the NSST index is coded after coding the non-zerotransform coefficient location, when an x position P_(x) and a yposition P_(y) of the last non-zero transform coefficient are smallerthan T_(x) and T_(y), respectively, the NSST index coding may be omittedand the 4×4 RST may not be applied.

For example, a case of T_(x)=1 and T_(y)=1 means that the NSST indexcoding is omitted for a case where the non-zero transform coefficientexists at the DC position.

A scheme of determining whether to code the NSST index throughcomparison with the threshold may be differently applied to luma andchroma. For example, different T_(x) and T_(y) may be applied to theluma and the chroma and the threshold may be applied to the luma and notapplied to the chroma. Or vice versa.

Two methods described above, that is, a first method for omitting theNSST index coding when the non-zero transform coefficient is located ina region where the valid transform coefficient does not exist and asecond method for omitting the NSST index coding when each of an Xcoordinate and a Y coordinate for the non-zero transform coefficient issmaller than a predetermined threshold may be simultaneously applied.

For example, a threshold for a position coordinate of the last non-zerotransform coefficient may be first checked and then it may be checkedwhether the last non-zero transform coefficient is located in the regionwhere the valid transform coefficient does not exist. Alternatively, theorder may be changed.

Methods presented in Embodiment 4 may be applied even to the 8×8 RST.That is, when the last non-zero transform coefficient is located in aregion other than the top-left 4×4 in the top-left 8×8 region, thecoding for the NSST index may be omitted and if not, the NSST indexcoding may be performed.

Further, when both X and Y coordinate values for the non-zero transformcoefficient are less than a threshold, the coding for the NSST index maybe omitted. Alternatively, two methods may be applied together.

Embodiment 5: Applying Different NSST Index Coding and Residual CodingSchemes to Luma and Chroma When Applying RST

The schemes described in Embodiments 3 and 4 above may be differentlyapplied to luma and chroma, respectively. That is, the NSST index codingand residual coding schemes for the luma and the chroma may bedifferently applied.

For example, the luma may adopt the scheme of Embodiment 4 above and thechroma may adopt the scheme of Embodiment 3 above. Alternatively, theluma may adopt the conditional NSST index coding presented in Embodiment3 or 4 above and the chroma may not adopt the conditional NSST indexcoding. Or vice versa.

FIG. 20 is a flowchart of encoding a video signal based on reducedsecondary transform as an embodiment to which the present disclosure isapplied.

The encoder may determine (or select) the forward secondary transformbased on at least one of the prediction mode, the block shape, and/orthe block size of the current block (S2010). In this case, a candidateof the forward secondary transform may include at least one of theembodiments of FIG. 6 and/or FIG. 12 above.

The encoder may determine an optimal forward secondary transform throughRate Distortion optimization. The optimal forward secondary transformmay correspond to one of a plurality of transform combinations and theplurality of transform combinations may be defined by a transform index.For example, for the RD optimization, results of performing all of theforward secondary transform, quantization, residual coding, etc., may becompared for respective candidates. In this case, an equation such ascost=rate+λ·distortion or cost=distortion+λ·rate may be used, but thepresent disclosure is not limited thereto.

The encoder may signal a secondary transform index corresponding to theoptimal forward secondary transform (S2020). Here, the secondarytransform index may adopt other embodiments described in the presentdisclosure.

For example, the secondary transform index may adopt the transform setconfiguration of FIG. 12 above. Since one transform set includes two orthree transforms according to the intra prediction mode, one of amaximum of four transforms may be configured to be selected in additionto a case of not applying the secondary transform. When indexes of 0, 1,2, and 3 are assigned to the four transforms, respectively, an appliedtransform may be designated by signaling the secondary transform indexfor each transform coefficient block. In this case, index 0 may beallocated to a case where the identity matrix, i.e., the secondarytransform is not applied.

As another embodiment, the signaling of the secondary transform indexmay be performed in any one step of 1) before residual coding, 2) in themiddle of residual coding (after coding the non-zero transformcoefficient position), or 3) after residual coding. The embodiments willbe described below in detail.

1) Method for Signaling Secondary Transform Index Before Residual Coding

The encoder may determine the forward secondary transform.

The encoder may signal the secondary transform index corresponding tothe forward secondary transform.

The encoder may code the position of the last non-zero transformcoefficient.

The encoder may perform residual coding for syntax elements other thanthe position of the last non-zero transform coefficient.

2) Method for Signaling Secondary Transform Index in Middle Of ResidualCoding

The encoder may determine the forward secondary transform.

The encoder may code the position of the last non-zero transformcoefficient.

When the non-zero transform coefficient is not located in a specificregion, the encoder may code the secondary transform index correspondingto the forward secondary transform. Here, in the case where the reducedsecondary transform is applied, the specific region represents aremaining region other than the position where the non-zero transformcoefficient may exist when the transform coefficients are arrangedaccording to the scan order. However, the present disclosure is notlimited thereto.

The encoder may perform residual coding for syntax elements other thanthe position of the last non-zero transform coefficient.

3) Method for Signaling Secondary Transform Index Before Residual Coding

The encoder may determine the forward secondary transform.

The encoder may code the position of the last non-zero transformcoefficient.

When the non-zero transform coefficient is not located in a specificregion, the encoder may perform residual coding for syntax elementsother than the position of the last non-zero transform coefficient.Here, in the case where the reduced secondary transform is applied, thespecific region represents a remaining region other than the positionwhere the non-zero transform coefficient may exist when the transformcoefficients are arranged according to the scan order. However, thepresent disclosure is not limited thereto.

The encoder may signal the secondary transform index corresponding tothe forward secondary transform.

Meanwhile, the encoder may perform the forward first order transform forthe current block (residual block) (S2030). Here, step S2010 and/or stepS2020 may be similarly applied to the forward primary transform.

The encoder may perform the forward secondary transform for the currentblock by using the optimal forward secondary transform (S2040). Forexample, the optimal forward secondary transform may be the reducedsecondary transform. The reduced secondary transform refers to atransform in which N residual data (N×1 residual vectors) are input andL (L<N) transform coefficient data (L×1 transform coefficient vectors)are output.

As an embodiment, the reduced secondary transform may be applied to aspecific region of the current block. For example, when the currentblock is N×N, the specific region may mean a top-left N/2×N/2 region.However, the present disclosure is not limited thereto and may bedifferently configured according to at least one of the prediction mode,the block shape, or the block size. For example, when the current blockis N×N, the specific region may mean a top-left M×M region (M≤N).

Meanwhile, the encoder performs quantization for the current block togenerate a transform coefficient block (S2050).

The encoder performs entropy encoding for the transform coefficientblock to generate the bitstream.

FIG. 21 is a flowchart of decoding a video signal based on reducedsecondary transform as an embodiment to which the present disclosure isapplied.

The decoder may obtain the secondary transform index from the bitstream(S2110). Here, the secondary transform index may adopt other embodimentsdescribed in the present disclosure. For example, the secondarytransform index may include at least one of the embodiments of FIG. 6and/or FIG. 12 above.

As another embodiment, the obtaining of the secondary transform indexmay be performed in any one step of 1) before residual coding, 2) in themiddle of residual coding (after decoding the non-zero transformcoefficient position), or 3) after residual coding.

The decoder may derive the secondary transform corresponding to thesecondary transform index (S2120). In this case, the candidate of thesecondary transform may include at least one of the embodiments of FIG.6 and/or FIG. 12 above.

However, steps S2110 and S2120 are embodiments and the presentdisclosure is not limited thereto. For example, the decoder may notobtain the secondary transform index, but derive the secondary transformbased on at least one of the prediction mode, the block shape, and/orthe block size of the current block.

Meanwhile, the decoder may obtain the transform coefficient block byentropy-decoding the bitstream and perform dequantization for thetransform coefficient block (S2130).

The decoder may perform the inverse secondary transform for thedequantized transform coefficient block (S2140). For example, theinverse secondary transform may be the reduced secondary transform. Thereduced secondary transform means a transform in which N residual data(N×1 residual vectors) are input and L (L<N) transform coefficient data(L×1 transform coefficient vectors) are output.

As an embodiment, the reduced secondary transform may be applied to aspecific region of the current block. For example, when the currentblock is N x N, the specific region may mean a top-left N/2×N/2 region.However, the present disclosure is not limited thereto and may bedifferently configured according to at least one of the prediction mode,the block shape, or the block size. For example, when the current blockis N×N, the specific region may mean a top-left M×M region (M≤N) or M×L(M≤N, L≤N).

In addition, the decoder may perform the inverse primary transform forthe inverse secondary transform result (S2150).

The decoder generates the residual block through step S2150 and theresidual block and the prediction block are added to generate areconstruction block.

FIG. 22 illustrates a content streaming system to which the disclosureis applied.

Referring to FIG. 22, the content streaming system to which thedisclosure is applied may basically include an encoding server, astreaming server, a web server, a media storage, a user equipment and amultimedia input device.

The encoding server basically functions to generate a bitstream bycompressing content input from multimedia input devices, such as asmartphone, a camera or a camcorder, into digital data, and to transmitthe bitstream to the streaming server. For another example, ifmultimedia input devices, such as a smartphone, a camera or a camcorder,directly generate a bitstream, the encoding server may be omitted.

The bitstream may be generated by an encoding method or bitstreamgeneration method to which the disclosure is applied. The streamingserver may temporally store a bitstream in a process of transmitting orreceiving the bitstream.

The streaming server transmits multimedia data to the user equipmentbased on a user request through the web server. The web server plays arole as a medium to notify a user that which service is provided. When auser requests a desired service from the web server, the web servertransmits the request to the streaming server. The streaming servertransmits multimedia data to the user. In this case, the contentstreaming system may include a separate control server. In this case,the control server functions to control an instruction/response betweenthe apparatuses within the content streaming system.

The streaming server may receive content from the media storage and/orthe encoding server. For example, if content is received from theencoding server, the streaming server may receive the content in realtime. In this case, in order to provide smooth streaming service, thestreaming server may store a bitstream for a given time.

Examples of the user equipment may include a mobile phone, a smartphone, a laptop computer, a terminal for digital broadcasting, personaldigital assistants (PDA), a portable multimedia player (PMP), anavigator, a slate PC, a tablet PC, an ultrabook, a wearable device(e.g., a watch type terminal (smartwatch), a glass type terminal (smartglass), and a head mounted display (HMD)), digital TV, a desktopcomputer, and a digital signage.

The servers within the content streaming system may operate asdistributed servers. In this case, data received from the servers may bedistributed and processed.

As described above, the embodiments described in the disclosure may beimplemented and performed on a processor, a microprocessor, a controlleror a chip. For example, the function units illustrated in the drawingsmay be implemented and performed on a computer, a processor, amicroprocessor, a controller or a chip.

Furthermore, the decoder and the encoder to which the disclosure isapplied may be included in a multimedia broadcasting transmission andreception device, a mobile communication terminal, a home cinema videodevice, a digital cinema video device, a camera for monitoring, a videodialogue device, a real-time communication device such as videocommunication, a mobile streaming device, a storage medium, a camcorder,a video on-demand (VoD) service provision device, an over the top (OTT)video device, an Internet streaming service provision device, athree-dimensional (3D) video device, a video telephony device, and amedical video device, and may be used to process a video signal or adata signal. For example, the OTT video device may include a gameconsole, a Blu-ray player, Internet access TV, a home theater system, asmartphone, a tablet PC, and a digital video recorder (DVR).

Furthermore, the processing method to which the disclosure is appliedmay be produced in the form of a program executed by a computer, and maybe stored in a computer-readable recording medium. Multimedia datahaving a data structure according to the disclosure may also be storedin a computer-readable recording medium. The computer-readable recordingmedium includes all types of storage devices in which computer-readabledata is stored. The computer-readable recording medium may include aBlu-ray disk (BD), a universal serial bus (USB), a ROM, a PROM, anEPROM, an EEPROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, andan optical data storage device, for example. Furthermore, thecomputer-readable recording medium includes media implemented in theform of carriers (e.g., transmission through the Internet). Furthermore,a bit stream generated using an encoding method may be stored in acomputer-readable recording medium or may be transmitted over wired andwireless communication networks.

Furthermore, an embodiment of the disclosure may be implemented as acomputer program product using program code. The program code may beperformed by a computer according to an embodiment of the disclosure.The program code may be stored on a carrier readable by a computer.

The aforementioned preferred embodiments of the disclosure have beendisclosed for illustrative purposes, and those skilled in the art mayimprove, change, substitute, or add various other embodiments withoutdeparting from the technical spirit and scope of the disclosuredisclosed in the attached claims.

1. A method of reconstructing a video signal based on a reducedsecondary transform, comprising: obtaining a secondary transform indexfrom the video signal; deriving a secondary transform corresponding tothe secondary transform index, wherein the secondary transformrepresents a reduced secondary transform, and the reduced secondarytransform represents a transform outputting L (L<N) transformcoefficient data (L×1 transform coefficient vectors) based on inputted Nresidual data (N×1 residual vectors); obtaining a transform coefficientblock by performing an entropy decoding and a dequantization for acurrent block (N×N); performing an inverse secondary transform for thetransform coefficient block using the reduced secondary transform;performing an inverse primary transform for a block which the inversesecondary transform is applied to; and reconstructing the current blockusing a block which the inverse primary transform is applied to.
 2. Themethod of claim 1, wherein the reduced secondary transform is applied toa specific region of the current block, and wherein the specific regionis a left-top M×M (M≤N) in the current block.
 3. The method of claim 1,wherein when the inverse secondary transform is performed, a 4×4 reducedsecondary transform is applied to each of divided 4×4 blocks in thecurrent block.
 4. The method of claim 1, wherein whether the secondarytransform index is obtained is determined based on a position of a lastnon-zero transform coefficient in the transform coefficient block. 5.The method of claim 4, wherein when the last non-zero transformcoefficient is not located in a specific region, the secondary transformindex is obtained, and wherein the specific region represents aremaining region other than a position where a non-zero transformcoefficient may exist when transform coefficients are arranged accordingto a scan order if the reduced secondary transform is applied.
 6. Themethod of claim 1, further comprising: obtaining a primary transformindex of the current block from the video signal, wherein the primarytransform index corresponds to any one of a plurality of transformcombinations configured by a combination of DST7 and/or DCT8; andderiving a transform combination corresponding to the primary transformindex, wherein the transform combination includes a horizontal transformand a vertical transform, and the horizontal transform and the verticaltransform correspond to any one of the DST7 or the DCT8, and wherein theinverse primary transform is performed using the transform combination.7. An apparatus of reconstructing a video signal based on a reducedsecondary transform, comprising: a parsing unit obtaining a secondarytransform index from the video signal; a transform unit deriving asecondary transform corresponding to the secondary transform index,wherein the secondary transform represents a reduced secondarytransform, and the reduced secondary transform represents a transformoutputting L (L<N) transform coefficient data (L×1 transform coefficientvectors) based on inputted N residual data (N×1 residual vectors); anentropy decoding unit performing an entropy decoding for a current block(N×N); a dequantization unit performing a dequantization for the currentblock in which the entropy decoding is performed to obtain a transformcoefficient block; the transform unit performing an inverse secondarytransform for the transform coefficient block using the reducedsecondary transform and performing an inverse primary transform andperforming an inverse primary transform for a block which the inversesecondary transform is applied to; and a reconstruction unitreconstructing the current block using a block which the inverse primarytransform is applied to.
 8. The apparatus of claim 7, wherein thereduced secondary transform is applied to a specific region of thecurrent block, and wherein the specific region is a left-top M×M (M≤N)in the current block.
 9. The apparatus of claim 7, wherein when theinverse secondary transform is performed, a 4×4 reduced secondarytransform is applied to each of divided 4×4 blocks in the current block.10. The apparatus of claim 7, wherein whether the secondary transformindex is obtained is determined based on a position of a last non-zerotransform coefficient in the transform coefficient block.
 11. Theapparatus of claim 10, wherein when the last non-zero transformcoefficient is not located in a specific region, the secondary transformindex is obtained, and wherein the specific region represents aremaining region other than a position where a non-zero transformcoefficient may exist when transform coefficients are arranged accordingto a scan order if the reduced secondary transform is applied.
 12. Theapparatus of claim 7, further comprising: the parsing unit obtaining aprimary transform index of the current block from the video signal,wherein the primary transform index corresponds to any one of aplurality of transform combinations configured by a combination of DST7and/or DCT8; and the transform unit deriving a transform combinationcorresponding to the primary transform index, wherein the transformcombination includes a horizontal transform and a vertical transform,and the horizontal transform and the vertical transform correspond toany one of the DST7 or the DCT8, and wherein the inverse primarytransform is performed using the transform combination.